package net.nohaven.proj.javeau.fs.crypt;

import java.io.File;

import net.nohaven.proj.javeau.fs.exceptions.ConditionsNotMetException;
import net.nohaven.proj.javeau.fs.exceptions.GenericIOException;

public class CFSFactory {
	private File baseDir;
	private char[] passwd;

	public CFSFactory(File baseDir, char[] passwd)
			throws ConditionsNotMetException {
		if (!baseDir.isDirectory())
			throw new ConditionsNotMetException("Base is not a directory");
		this.baseDir = baseDir;
		this.passwd = passwd;
	}

	public CFSFilesystem getInstance(boolean useLock)
			throws ConditionsNotMetException, GenericIOException {
		return new CFSFilesystem(baseDir, passwd, useLock);
	}
}
